package com.easyattendance.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

@Entity
@Table(name="tbl_subject_teacher")
@IdClass(SubjectTeacherPK.class)
public class SubjectTeacher {
	
	@Id
	@GenericGenerator(name="teacher_id",strategy="foreign")
	@Column(name="teacher_id",length=15,nullable=false)
	private String teacher_id;
	 
	@Id
	@GenericGenerator(name="subject_id",strategy="foreign")
	@Column(name="subject_id",length=6)
	private String subject_id;
	 
	@Column(name="lecture_status",length=2,nullable=false)
	private int lecture_status;
	
	@Column(name="total_lecture_status",length=2,nullable=false)
	private int total_lecture_status;
	 
	 @ManyToOne
	 @JoinColumn(name="teacher_id", insertable=false,updatable=false,referencedColumnName="teacher_id")
	 private Teacher teacher; 
	 
	 @ManyToOne
	 @JoinColumn(name="subject_id", insertable=false,updatable=false,referencedColumnName="subject_id")
	 private Subject subject;
	 
	public SubjectTeacher() {

	}

	public SubjectTeacher(String teacher_id, String subject_id,
			int lecture_status, int total_lecture_status) {
		super();
		this.teacher_id = teacher_id;
		this.subject_id = subject_id;
		this.lecture_status = lecture_status;
		this.total_lecture_status = total_lecture_status;
	}

	public SubjectTeacher(String teacher_id, String subject_id) {
		super();
		this.teacher_id = teacher_id;
		this.subject_id = subject_id;
	}

	public SubjectTeacher(String teacher_id, String subject_id,
			int lecture_status,int total_lecture_status, Teacher teacher, Subject subject) {
		super();
		this.teacher_id = teacher_id;
		this.subject_id = subject_id;
		this.lecture_status = lecture_status;
		this.total_lecture_status = total_lecture_status;
		this.teacher = teacher;
		this.subject = subject;
	}

	public String getTeacher_id() {
		return teacher_id;
	}

	public void setTeacher_id(String teacher_id) {
		this.teacher_id = teacher_id;
	}

	public String getSubject_id() {
		return subject_id;
	}

	public void setSubject_id(String subject_id) {
		this.subject_id = subject_id;
	}
	
	public int getLecture_status() {
		return lecture_status;
	}

	public void setLecture_status(int lecture_status) {
		this.lecture_status = lecture_status;
	}

	public Teacher getTeacher() {
		return teacher;
	}

	public void setTeacher(Teacher teacher) {
		this.teacher = teacher;
	}

	public Subject getSubject() {
		return subject;
	}

	public void setSubject(Subject subject) {
		this.subject = subject;
	}

	public int getTotal_lecture_status() {
		return total_lecture_status;
	}

	public void setTotal_lecture_status(int total_lecture_status) {
		this.total_lecture_status = total_lecture_status;
	}
	 
}
